package com.runoob.java;

import java.util.Arrays;

/**
 * 数组的操作
 *
 */
public class TestArray {
    public static void main(String[] args) {
        // 一维数组
        double[] myList = {1.9, 2.9, 3.9, 4.5};
        for (int i = 0; i < myList.length; i++) {
            System.out.println( myList[i] + " ");
        }

        double total = 0;
        for (int i = 0; i < myList.length; i++) {
            total += myList[i];
        }
        System.out.println("Total is = " + total);

        // 多维数组
        String str[][] = new String[3][4];
        int[][] a = new int[2][3];

        // Arrays类，方便的操作数组，他提供的所有方法都是静态的
        a[0][0] = 10;
        a[0][1] = 11;
        a[0][2] = 12;
        a[1][0] = 20;
        a[1][1] = 21;
        a[1][2] = 22;
//        int[] searchValue = {10, 11, 12};
//        int rst = Arrays.binarySearch(a, searchValue);
//        System.out.println("查找值 = " + rst);

    }
}
